#include<cstdio>//uncle-lu
#include<cstring>
#include<vector>
#include<algorithm>
template<class T>void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9') { f|=(ch=='-'); ch=getchar(); }
	while(ch<='9'&&ch>='0') { x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); }
	x = f ? -x : x;
	return ;
}

std::vector<int>edge[100010];
bool visit[100010];
int mx, n, m;

void DFS(int x)
{
	mx = std::max(mx, x);

	for (int i = 0; i < (int)edge[x].size(); i++) 
	{
		int v = edge[x][i];
		if(visit[v])continue;
		visit[v] = true;
		DFS(v);
	}

	return ;
}

int main()
{
	read(n);read(m);
	int x, y;
	for (int i = 1; i <= m; i++) 
	{
		read(x);read(y);
		edge[x].push_back(y);
	}

	for (int i = 1; i <= n; i++) 
	{
		memset(visit, false, sizeof(visit));
		mx = 0;
		DFS(i);
		printf("%d ", mx);
	}

	return 0;
}
